package com.fangxu.dota2helper.greendao;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.fangxu.dota2helper.greendao.GreenNews;
import com.fangxu.dota2helper.greendao.GreenStrategy;
import com.fangxu.dota2helper.greendao.GreenUpdate;
import com.fangxu.dota2helper.greendao.GreenVideo;
import com.fangxu.dota2helper.greendao.GreenWatchedVideo;

import com.fangxu.dota2helper.greendao.GreenNewsDao;
import com.fangxu.dota2helper.greendao.GreenStrategyDao;
import com.fangxu.dota2helper.greendao.GreenUpdateDao;
import com.fangxu.dota2helper.greendao.GreenVideoDao;
import com.fangxu.dota2helper.greendao.GreenWatchedVideoDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig greenNewsDaoConfig;
    private final DaoConfig greenStrategyDaoConfig;
    private final DaoConfig greenUpdateDaoConfig;
    private final DaoConfig greenVideoDaoConfig;
    private final DaoConfig greenWatchedVideoDaoConfig;

    private final GreenNewsDao greenNewsDao;
    private final GreenStrategyDao greenStrategyDao;
    private final GreenUpdateDao greenUpdateDao;
    private final GreenVideoDao greenVideoDao;
    private final GreenWatchedVideoDao greenWatchedVideoDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        greenNewsDaoConfig = daoConfigMap.get(GreenNewsDao.class).clone();
        greenNewsDaoConfig.initIdentityScope(type);

        greenStrategyDaoConfig = daoConfigMap.get(GreenStrategyDao.class).clone();
        greenStrategyDaoConfig.initIdentityScope(type);

        greenUpdateDaoConfig = daoConfigMap.get(GreenUpdateDao.class).clone();
        greenUpdateDaoConfig.initIdentityScope(type);

        greenVideoDaoConfig = daoConfigMap.get(GreenVideoDao.class).clone();
        greenVideoDaoConfig.initIdentityScope(type);

        greenWatchedVideoDaoConfig = daoConfigMap.get(GreenWatchedVideoDao.class).clone();
        greenWatchedVideoDaoConfig.initIdentityScope(type);

        greenNewsDao = new GreenNewsDao(greenNewsDaoConfig, this);
        greenStrategyDao = new GreenStrategyDao(greenStrategyDaoConfig, this);
        greenUpdateDao = new GreenUpdateDao(greenUpdateDaoConfig, this);
        greenVideoDao = new GreenVideoDao(greenVideoDaoConfig, this);
        greenWatchedVideoDao = new GreenWatchedVideoDao(greenWatchedVideoDaoConfig, this);

        registerDao(GreenNews.class, greenNewsDao);
        registerDao(GreenStrategy.class, greenStrategyDao);
        registerDao(GreenUpdate.class, greenUpdateDao);
        registerDao(GreenVideo.class, greenVideoDao);
        registerDao(GreenWatchedVideo.class, greenWatchedVideoDao);
    }
    
    public void clear() {
        greenNewsDaoConfig.getIdentityScope().clear();
        greenStrategyDaoConfig.getIdentityScope().clear();
        greenUpdateDaoConfig.getIdentityScope().clear();
        greenVideoDaoConfig.getIdentityScope().clear();
        greenWatchedVideoDaoConfig.getIdentityScope().clear();
    }

    public GreenNewsDao getGreenNewsDao() {
        return greenNewsDao;
    }

    public GreenStrategyDao getGreenStrategyDao() {
        return greenStrategyDao;
    }

    public GreenUpdateDao getGreenUpdateDao() {
        return greenUpdateDao;
    }

    public GreenVideoDao getGreenVideoDao() {
        return greenVideoDao;
    }

    public GreenWatchedVideoDao getGreenWatchedVideoDao() {
        return greenWatchedVideoDao;
    }

}
